<template>
  <div class="pagination">
    <el-pagination :small="true" background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="listQuery.PageIndex" :page-sizes="pageSizes" :page-size="listQuery.PageSize" layout="total, sizes, prev, pager, next, jumper" :total="total">
    </el-pagination>
  </div>
</template>
<script>

/**
 * @example
 * <pagination @getTableData="getList" :total="" :listQuery="listQuery"/>
 */
export default {
  name: 'pagination',
  props: {
    listQuery: {
      type: Object,
      required: true
    },
    total: {
      required: true
    },
    pageSizes: {
      type: Array,
      default: () => [50, 100, 150]
    }
  },
  methods: {
    handleSizeChange(val) {
      this.listQuery.PageSize = val;
      this.$emit('getTableData', val, 'size');
    },
    handleCurrentChange(val) {
      this.listQuery.PageIndex = val;
      this.$emit('getTableData', val, 'page');
    }
  }
};
</script>
<style scoped>
.pagination {
  width: 100%;
  text-align: right;
  padding-top: 5px;
}
/* .el-pagination{
    display: inline-block
} */
</style>
